package com.haisen.dataobject.mapper.base;

import com.haisen.core.utils.MyMapper;
import com.haisen.dataobject.entity.Organization;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrganizationMapper extends MyMapper<Organization> {
    int updateSalefParentIds(String makeSelfAsParentIds);

    @Select("select a.id,a.area_id as areaId,a.no as no,a.name,a.parent_id as parentId,a.parent_ids as parentIds,type,stars,address,channel_no as channelNo,a.owner_no as ownerNo,user_id as userId,available,priority,leaf,IFNULL(b.username,'') as dutyName,IFNULL(b.phone,'') as phone from sys_organization a Left JOIN sys_user b  on a.user_id=b.id where a.parent_id = #{0}")
    List<Organization> selectWithUserByPid(Long pid);
}